package RJZ.Rainbow.Dao;

import RJZ.Rainbow.entity.Chequer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ChequerDao {
    @Select("SELECT count(*) FROM box_chequer WHERE using_or_not=0")
    Integer GetEmptyCount();

    @Select("SELECT * FROM box_chequer WHERE using_or_not=0 LIMIT 1")
    Chequer GetEmptyChequer();

    @Select("SELECT * FROM  box_chequer WHERE chequer_id=#{chequerid}")
    Chequer GetChequerByID(@Param("chequerid") int chequerid);

    @Update("UPDATE box_chequer SET using_or_not=#{type} where chequer_id=#{chequerid}")
    void UpdateChequerStatus(@Param("type")int type,@Param("chequerid")int chequerid);

    @Update("UPDATE box_chequer SET temperature =#{temp} WHERE chequer_id=#{chequerid}")
    void UpdateChequerTemperature(@Param("temp")int temp,@Param("chequerid")int chequerid);

}